home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-10-26 | 2.1 KB | 52 lines | [TEXT/MPS ] |
- SuspendEvent
-
- A simple example of suspending and resuming an AppleEvent.
-
- What it Does....
-
- This simple application has two document types, FRED and AL documents.
- When it receives an 'odoc' OpenDocuments event, it looks that the
- files it has been asked to open. If it has been asked to open
- FRED documents, it opens them at once. If it has been asked to
- open AL documents, it suspends the event. It waits until you
- click in a window before it actually opens the AL document.
-
- A real good way to watch it work is to select all three documents (in the Finder),
- FredDoc1,FredDoc2, and AlDoc and select 'Open' from
- the Finder's FILE menu. The two Fred documents will open, and the Al document
- will be suspended until you click in one of the windows.
-
- Things to Look At...
-
- To suspend and resume appleevents, you have got to keep the event and reply
- around for the event you have suspended.
- ••• NOTE!!!! Do NOT copy the Pointer that you got passed! You have to save the
- acutal AEDesc structure, the DescriptorType and DataHandle! If you just
- copy the pointer to that structure that you have been passed, Bad Things
- (like bus errors) wil happen when you resume the event, because the AppleEVent
- Manager may have moved the data so the pointer you now have is not valid.
- So, DON'T DO
- AEDesc * savedEvent = eventIn;
- instead do...
- AEDesc savedEvent = *eventIn;
- Copy the CONTENTS, not the pointer!
-
- Of course, if you are going to be suspending and resuming a few events,
- you'll need to build some kind of queuing system for yourself.
-
- • NOTE: Don't suspend gratuitiously. Some AppleEvent Manager calls rely on the
- context of the current event to work correctly. specifically if you do something
- like
- AESuspendTheCurrentEvent(....);
- AEInteractWithUSer(...);
- AEResumeTheCurrentEvent(...);
- You've blown away the context that AEInteract needs to know about, and you might not
- get the behaviour you want (MacApp users note: MacApp does this, that is _wrong_
- and you should modify the TServerEvent class).
-
- Please also note the beautiful icons this application uses. Now you know
- why I'm a programmer.
-
- Have a Nice Event,
- C.K. Haun
- Apple Developer Tech Support